<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <beetl>include("/inc/head.html"){}</beetl>
    <title>用户列表</title>
    
    <script>
        function del(id) {
            swal({
                        title              : "您确定要删除当前用户？",
                        text               : "删除后无法恢复，请确认后删除！",
                        type               : "warning",
                        showCancelButton   : true,
                        confirmButtonColor : "#DD6B55",
                        confirmButtonText  : "删除",
                        cancelButtonText   : "保留",
                        closeOnConfirm     : false,
                        closeOnCancel      : false,
                        showLoaderOnConfirm: true
                    },
                    function (isConfirm) {
                        if (isConfirm) {
                            location.href = '${ctxPath}/shiro/user/delete/' + id;
                            swal("提示", "删除成功！", "success");
                        } else {
                            swal("提示", "用户未被删除！", "info");
                        }
                    });
        }
        
        function timeFormatter(value, row) {
            return new Date(value).format('yyyy-MM-dd HH:mm:ss');
        }
        function actionFormatter(value, row) {
            var html = [];
            html.push('<button class="btn btn-warning" onclick="location.href=\'${ctxPath}/shiro/user/update/{0}\'">编辑</button>'.replace('{0}', row.id));
            html.push('<button class="btn btn-danger" onclick="del(\'{0}\');">删除</button>'.replace('{0}', row.id));
            return html.join('');
        }
    </script>
</head>
<body>

<beetl>include("/shiro/top.html"){}</beetl>

<div class="container-fluid">
    <ol class="breadcrumb">
        <li><a href="${ctxPath}/shiro/main">权限管理</a></li>
        <li class="active">用户管理</li>
    </ol>
    
    <div class="table-responsive">
        <table data-toggle="table" data-id-field="id" data-method="post" data-query-params="$.fn.bootstrapTable.queryParams"
               data-sort-name="modified" data-sort-order="desc"
               data-side-pagination="server" data-url="${ctxPath}/shiro/user/list"
               data-pagination="true" data-search="false" data-search-on-enter-key="true" data-search-text="" data-show-columns="true"
               data-show-pagination-switch="true" data-maintain-selected="true"
               data-page-number="1" data-page-size="10" data-page-list="[10, 25, 50, 100]">
            <thead>
            <tr>
                <th data-field="id" data-visible="false">ID</th>
                <th data-field="name" data-sortable="true">姓名</th>
                <th data-field="loginName">登陆名称</th>
                <th data-field="created" data-sortable="true" data-formatter="timeFormatter">创建时间</th>
                <th data-field="modified" data-sortable="true" data-formatter="timeFormatter">最后修改时间</th>
                <th data-formatter="actionFormatter">操作</th>
            </tr>
            </thead>
        </table>
    </div>
</div>
</body>
</html>